package odgs.app.server;

import javax.swing.JLabel;

import odgs.Contents;
import odgs.ContentsFile;
import odgs.Directory;
import odgs.ExplorerNode;
import odgs.listener.ServerManagerListener;
import odgs.manager.ServerManager;

public class GridNodeStateBarModel implements ServerManagerListener {

	private JLabel stateBar;
	private ServerManager manager;
	
	public GridNodeStateBarModel(ServerManager manager, JLabel stateBar) {
		this.manager = manager;
		this.stateBar = stateBar;
		updateData();
		manager.addServerManagerListener(this);
	}

	public void joinedNode(String id) {
		updateData();
	}
	
	private void updateData() {
		stateBar.setText("Joined Node : " + manager.getGridNodeCount() + "     Logined Node : " + manager.getLoginedCount() + " ");
	}

	public void loginedNode(String id){
		updateData();
	}

	public void logout(String id) {
		updateData();
	}

	public void addedContents(Contents contents) {}
	public void addedDirectory(Directory directory) {}
	public void error(int error) {}
	public void freeStorage(ContentsFile file) {}
	public void log(String log) {}
	public void removeContents(Contents contents) {}
	public void removeDirectory(Directory directory) {}
	public void serverOpened(int port) {}
	public void useStorage(ContentsFile file) {}
	public void updatedExplorerNode(String mode, ExplorerNode node, String name){}
}
